package com.lion.repository.service.impl;

import java.util.List;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lion.repository.service.ProcDefService;

/**
 * 
 * @ClassName: ProcessDefineServiceImpl
 * @Description: 流程定义实现类
 * @author lion
 * @date 2018年7月18日
 *
 */
@Service
public class ProcDefServiceImpl implements ProcDefService {

	@Autowired
	private RepositoryService repositoryService;

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public void insert() {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete() {
		// TODO Auto-generated method stub

	}

	@Override
	public void update() {
		// TODO Auto-generated method stub

	}

	@Override
	public void deploy(String processDefId) {
		ProcessDefinition define = repositoryService.getProcessDefinition(processDefId);
		
		//根据bpmn文件部署流程
		Deployment deployment = repositoryService.createDeployment().addClasspathResource(define.getResourceName()).deploy();

		//return deployment.getId();
	}

	@Override
	public ProcessDefinition getEntityById(String processDefId) {
		ProcessDefinition define = repositoryService.getProcessDefinition(processDefId);

		return define;
	}

	@Override
	public void getListPage() {
		// TODO Auto-generated method stub

	}

	@Override
	public List<ProcessDefinition> getList() {
		// TODO Auto-generated method stub
		return null;
	}

}
